/**
 * Array.js
 *
 * @author Maxime Ollagnier
 */
/**
 * Check if the given element exists in the array.
 */
Array.contains = function(array, element) {
	for (var i = 0; i < array.length; i++) {
		if (array[i] == element) {
			return true;
		}
	}
	return false;
};

/**
 * Removes the given element from the array.
 */
Array.remove = function(array, element) {
	var res = false;
	for (var i = 0; i < array.length; i++) {
		if (array[i] == element) {
            array.splice(i--, 1);
			res = true;
		}
	}
	return res;
};

/**
 * Pushes the given value in the first position of the array
 */
Array.pushFront = function(array, element) {
    array.reverse().push(element);
	return array.reverse();
};
